package gatesvr

import (
	"lnzw/common/controller"
	"lnzw/engine/net/tcp"
	"sync"
)

type GateController struct {
	*controller.DefaultController
}

var controllers sync.Map

func (c *GateController) OnClose() {
}

// 添加控制器
func AddController(id int64, client *tcp.SocketClient) {
	controllers.Store(id, &GateController{DefaultController: &controller.DefaultController{Client: client}})
}

func RemoveController(id int64) {
	controllers.Delete(id)
}

func GetController(id int64) *GateController {
	if v, ok := controllers.Load(id); ok {
		return v.(*GateController)
	}
	return nil
}
